home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap06 / howto03 / ufmgr32.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-01-04  |  56.3 KB  |  1,618 lines

  1. unit Ufmgr32;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, FileCtrl,
  8.    DRWSUtl1, DRWSUtl4, Grids;
  9.  
  10. type
  11.   TCCFileMgrForm = class(TForm)
  12.     Panel1: TPanel;
  13.     Panel2: TPanel;
  14.     BitBtn1: TBitBtn;
  15.     Panel3: TPanel;
  16.     Label1: TLabel;
  17.     BitBtn2: TBitBtn;
  18.     BitBtn3: TBitBtn;
  19.     BitBtn4: TBitBtn;
  20.     BitBtn5: TBitBtn;
  21.     BitBtn6: TBitBtn;
  22.     BitBtn7: TBitBtn;
  23.     OpenDialog1: TOpenDialog;
  24.     BitBtn8: TBitBtn;
  25.     BitBtn9: TBitBtn;
  26.     OpenDialog2: TOpenDialog;
  27.     BitBtn10: TBitBtn;
  28.     Panel4: TPanel;
  29.     Panel5: TPanel;
  30.     Panel6: TPanel;
  31.     Panel7: TPanel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.     Label4: TLabel;
  35.     BitBtn11: TBitBtn;
  36.     procedure FormResize(Sender: TObject);
  37.     procedure FormCreate(Sender: TObject);
  38.     procedure BitBtn7Click(Sender: TObject);
  39.     procedure BitBtn1Click(Sender: TObject);
  40.     procedure BitBtn2Click(Sender: TObject);
  41.     procedure BitBtn3Click(Sender: TObject);
  42.     procedure BitBtn4Click(Sender: TObject);
  43.     procedure BitBtn5Click(Sender: TObject);
  44.     procedure FormPaint(Sender: TObject);
  45.     procedure BitBtn8Click(Sender: TObject);
  46.     procedure BitBtn9Click(Sender: TObject);
  47.     procedure BitBtn6Click(Sender: TObject);
  48.     procedure BitBtn1DragDrop(Sender, Source: TObject; X, Y: Integer);
  49.     procedure BitBtn1DragOver(Sender, Source: TObject; X, Y: Integer;
  50.       State: TDragState; var Accept: Boolean);
  51.     procedure BitBtn2DragDrop(Sender, Source: TObject; X, Y: Integer);
  52.     procedure BitBtn3DragDrop(Sender, Source: TObject; X, Y: Integer);
  53.     procedure BitBtn4DragDrop(Sender, Source: TObject; X, Y: Integer);
  54.     procedure BitBtn10Click(Sender: TObject);
  55.     procedure FormDestroy(Sender: TObject);
  56.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  57.       Shift: TShiftState);
  58.     procedure BitBtn9KeyDown(Sender: TObject; var Key: Word;
  59.       Shift: TShiftState);
  60.     procedure Label2Click(Sender: TObject);
  61.     procedure Label3Click(Sender: TObject);
  62.     procedure Label4Click(Sender: TObject);
  63.     procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
  64.       Y: Integer);
  65.     procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  66.       Y: Integer);
  67.     procedure Panel4MouseMove(Sender: TObject; Shift: TShiftState; X,
  68.       Y: Integer);
  69.     procedure Panel3MouseMove(Sender: TObject; Shift: TShiftState; X,
  70.       Y: Integer);
  71.     procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  72.       Y: Integer);
  73.     procedure BitBtn2MouseMove(Sender: TObject; Shift: TShiftState; X,
  74.       Y: Integer);
  75.     procedure BitBtn3MouseMove(Sender: TObject; Shift: TShiftState; X,
  76.       Y: Integer);
  77.     procedure BitBtn4MouseMove(Sender: TObject; Shift: TShiftState; X,
  78.       Y: Integer);
  79.     procedure BitBtn5MouseMove(Sender: TObject; Shift: TShiftState; X,
  80.       Y: Integer);
  81.     procedure BitBtn8MouseMove(Sender: TObject; Shift: TShiftState; X,
  82.       Y: Integer);
  83.     procedure BitBtn9MouseMove(Sender: TObject; Shift: TShiftState; X,
  84.       Y: Integer);
  85.     procedure BitBtn6MouseMove(Sender: TObject; Shift: TShiftState; X,
  86.       Y: Integer);
  87.     procedure BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
  88.       Y: Integer);
  89.     procedure BitBtn10MouseMove(Sender: TObject; Shift: TShiftState; X,
  90.       Y: Integer);
  91.     procedure Panel5MouseMove(Sender: TObject; Shift: TShiftState; X,
  92.       Y: Integer);
  93.     procedure Panel6MouseMove(Sender: TObject; Shift: TShiftState; X,
  94.       Y: Integer);
  95.     procedure Panel7MouseMove(Sender: TObject; Shift: TShiftState; X,
  96.       Y: Integer);
  97.     procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
  98.       Shift: TShiftState; X, Y: Integer);
  99.     procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  100.       Shift: TShiftState; X, Y: Integer);
  101.     procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  102.       Shift: TShiftState; X, Y: Integer);
  103.     procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  104.       Shift: TShiftState; X, Y: Integer);
  105.     procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  106.       Shift: TShiftState; X, Y: Integer);
  107.     procedure BitBtn11Click(Sender: TObject);
  108.   private
  109.     { Private declarations }
  110.   public
  111.     { Public declarations }
  112.     DirectoryListBox1 : TDirectoryListBox;
  113.     FileListBox1 : TIconFileListBox;
  114.     ScrollBox1 : TFileIconPanelScrollbox;
  115.   end;
  116. var
  117.   CCFileMgrForm      : TCCFileMgrForm;
  118.   CurrentView        : Integer;  { This holds the current view setting      }
  119.  
  120. implementation
  121.  
  122. {$R *.DFM}
  123.  
  124. uses DDDFUnit,  { Include custom directory selection form }
  125.      CfmpfUn,   { Include custom options dialog           }
  126.      CCPrnMgr;  { Include printer manager unit            }
  127.  
  128. { Set up the resize to replace the icon buttons }
  129. procedure TCCFileMgrForm.FormResize(Sender: TObject);
  130. begin
  131.   { Send in the panel and global buttons list }
  132.   SpacePanelButtons( Panel2 );
  133. end;
  134.  
  135. { Delphi wrote this; use it to set everything up }
  136. procedure TCCFileMgrForm.FormCreate(Sender: TObject);
  137. var TheIconPanel : TFileIconPanel;
  138.     CurrentPath : String;
  139. begin
  140.   { Create the directory list box }
  141.   SavedForm := Self;
  142.   DirectoryListBox1 := TDirectoryListBox.Create( Panel1 );
  143.   DirectoryListBox1.Parent := Panel1;
  144.   DirectoryListBox1.Visible := true;
  145.   DirectoryListbox1.Top := 17;
  146.   DirectoryListbox1.Left := 0;
  147.   DirectoryListbox1.Height := Panel1.Height - 32;
  148.   DirectoryListbox1.Width := 0;
  149.   { Create the file list box }
  150.   FileListBox1 := TIconFileListBox.Create( Panel1 );
  151.   FileListBox1.Parent := Panel1;
  152.   FileListbox1.Top := 17;
  153.   FileListbox1.Left := 146;
  154.   FileListbox1.Height := Panel1.Height - 32;
  155.   FileListbox1.Width := 0;
  156.   FileListBox1.Visible := true;
  157.   FileListBox1.ShowGlyphs := true;
  158.   FileListBox1.MultiSelect := true;
  159.   FileListBox1.DragMode := dmAutomatic;
  160.   { Set intercomponent interactions }
  161.   DirectoryListBox1.FileList := FileListbox1;
  162.   DirectoryListBox1.DirLabel := Label1;
  163.   { Create the scrollbox }
  164.   ScrollBox1 := TFileIconPanelScrollBox.Create( Panel1 );
  165.   ScrollBox1.Parent := Panel1;
  166.   ScrollBox1.align := alClient;
  167.   ScrollBox1.Left := 0;
  168.   ScrollBox1.Top := 0;
  169.   ScrollBox1.Width := Panel1.Width - 32;
  170.   ScrollBox1.Height := Panel1.Height - 32;
  171.   ScrollBox1.IconsNeedRefreshing := false;
  172.   ScrollBox1.TheStoredHandle := Self.Handle;
  173.   ScrollBox1.TheParentForm := Self;
  174.   { Get the current directory with 0 parameter }
  175.   GetDir( 0 , CurrentPath );
  176.   { Set the display caption }
  177.   Label1.Caption := CurrentPath;
  178.   { Add a trailing \ if not root }
  179.   CurrentPath := ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentPath );
  180.   { Get the icons display using scrollbox1 }
  181.   ScrollBox1.GetIconsForEntireDirectory( CurrentPath );
  182.   { Set the Icon View as default }
  183.   CurrentView := 1;
  184.   { Start the FIP IOManager }
  185.   if not assigned( TheIOManager ) then
  186.   begin
  187.     TheIOManager := TIOManager.Create( Self );
  188.     TheIOManager.Parent := Self;
  189.     TheIOManager.InitLocks;
  190.   end;
  191.   if not Assigned( TheMouseManager ) then
  192.   begin
  193.     TheMouseManager := TMouseManager.Create( Self );
  194.     TheMouseManager.InitializeNormal;
  195.   end;
  196.   { Load the special cursor to toggle the LOCK keys }
  197.   Screen.Cursors[ CR_KEYSET ] := LoadCursor( hInstance , 'KEYSET' );
  198.   Screen.Cursors[ CR_NULL ] := LoadCursor( hInstance , 'BLANKCUR' );
  199.   Panel5.Cursor := CR_KEYSET;
  200.   Panel6.Cursor := CR_KEYSET;
  201.   Panel7.Cursor := CR_KEYSET;
  202.   Label2.Visible := TheIOManager.IsCapsLockDown;
  203.   Label3.Visible := TheIOManager.IsNumLockDown;
  204.   Label4.Visible := TheIOManager.IsScrollLockDown;
  205. end;
  206.  
  207. { Delphi wrote this; use it to close the application }
  208. procedure TCCFileMgrForm.BitBtn7Click(Sender: TObject);
  209. begin
  210.   Close;
  211. end;
  212.  
  213. { Delphi wrote this use it to perform a copy on all selected files }
  214. procedure TCCFileMgrForm.BitBtn1Click(Sender: TObject);
  215. var ThePosition  : Integer;       { Loop counter   }
  216.     CurrentName ,                 { Holds work name}
  217.     TheOldString : String;        { Holds Dir      }
  218.     finished     : Boolean;       { Loop control   }
  219.     WorkingDir   : String;        { Holds mod wd   }
  220.     TargetDir    : String;        { target of op   }
  221.     TheResult    : Integer;       { Modal res hold }
  222. begin
  223.   { Get current directory and save it for later }
  224.   GetDir( 0 , TheOldString );
  225.   { Check for need to add trailing \ }
  226.   WorkingDir := TheOldString;
  227.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  228.   { Display the Windows-based directory input form }
  229.   TheResult := DestDDForm.ShowModal;
  230.   { If not cancelled do the copy }
  231.   if TheResult = mrOK then
  232.   begin
  233.     { Get the target directory with \ OK }
  234.     TargetDir := DestDDForm.GetTargetDirectory;
  235.     { Show the hourglass to indicate waiting }
  236.     Screen.Cursor := crHourGlass;
  237.     { Setup to get all selections }
  238.     ThePosition := 1;
  239.     finished := false;
  240.     while not finished do
  241.     begin
  242.       { Call generic file getting routine based on current view}
  243.       case CurrentView of
  244.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  245.              ThePosition );
  246.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  247.              ThePosition );
  248.       end;
  249.       { If returns blank string out of selections so exit }
  250.       if CurrentName = '' then finished := true else
  251.       begin
  252.         { If a directory signal error }
  253.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  254.         begin
  255.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  256.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  257.           begin
  258.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  259.              TargetDir );
  260.           end;
  261.         end
  262.         else
  263.         begin
  264.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  265.         end;
  266.       end;
  267.     end;
  268.     { Reset to normal cursor }
  269.     Screen.Cursor := crDefault;
  270.   end;
  271.   { Reset to the original directory }
  272.   ChDir( TheOldString );
  273. end;
  274.  
  275. { Delphi wrote this, use it to move files which are selected }
  276. procedure TCCFileMgrForm.BitBtn2Click(Sender: TObject);
  277. var ThePosition  : Integer;       { Loop counter   }
  278.     CurrentName ,                 { Holds work name}
  279.     TheOldString : String;        { Holds Dir      }
  280.     finished     : Boolean;       { Loop control   }
  281.     WorkingDir   : String;        { Holds mod wd   }
  282.     TargetDir    : String;        { target of op   }
  283.     TheResult    : Integer;       { Modal res hold }
  284. begin
  285.   { Get current directory and save it for later }
  286.   GetDir( 0 , TheOldString );
  287.   { Check for need to add trailing \ }
  288.   WorkingDir := TheOldString;
  289.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  290.   { Display the Windows-based directory input form }
  291.   TheResult := DestDDForm.ShowModal;
  292.   { If not cancelled do the copy }
  293.   if TheResult = mrOK then
  294.   begin
  295.     { Get the target directory with \ OK }
  296.     TargetDir := DestDDForm.GetTargetDirectory;
  297.     { Show the hourglass to indicate waiting }
  298.     Screen.Cursor := crHourGlass;
  299.     { Set up to get all current selections }
  300.     ThePosition := 1;
  301.     finished := false;
  302.     while not finished do
  303.     begin
  304.       { Call generic file getting routine based on current view}
  305.       case CurrentView of
  306.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  307.              ThePosition );
  308.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  309.              ThePosition );
  310.       end;
  311.       { If returns blank string then out of selections }
  312.       if CurrentName = '' then finished := true else
  313.       begin
  314.         { If a directory signal error }
  315.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  316.         begin
  317.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  318.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  319.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  320.              TargetDir );
  321.         end
  322.         else
  323.         begin
  324.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  325.         end;
  326.       end;
  327.       { Reset to normal cursor }
  328.       Screen.Cursor := crDefault;
  329.     end;
  330.   end;
  331.   { Reset to the original directory }
  332.   ChDir( TheOldString );
  333.   if CurrentView = 1 then { Reset icon display if in view }
  334.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  335. end;
  336.  
  337. { Delphi wrote this, use it to delete files which are selected }
  338. procedure TCCFileMgrForm.BitBtn3Click(Sender: TObject);
  339. var ThePosition  : Integer;       { Loop counter   }
  340.     CurrentName ,                 { Holds work name}
  341.     TheOldString : String;        { Holds Dir      }
  342.     finished     : Boolean;       { Loop control   }
  343.     WorkingDir   : String;        { Holds mod wd   }
  344. begin
  345.   { Get current directory and save it for later }
  346.   GetDir( 0 , TheOldString );
  347.   { Check for need to add trailing \ }
  348.   WorkingDir := TheOldString;
  349.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  350.   { Set up to do loop for selected files }
  351.   ThePosition := 1;
  352.   finished := false;
  353.   while not finished do
  354.   begin
  355.     { Call generic file getting routine based on current view}
  356.     case CurrentView of
  357.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  358.            ThePosition );
  359.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  360.            ThePosition );
  361.     end;
  362.     { if returns blank string out of selections }
  363.     if CurrentName = '' then finished := true else
  364.     begin
  365.       { If its a directory signal error }
  366.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  367.       begin
  368.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation,
  369.          mbYesNoCancel , 0 ) = mrYes then
  370.         begin
  371.           ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  372.           Scrollbox1.TheFWB.RemoveDirectory( Currentname );
  373.         end;
  374.       end
  375.       else
  376.       begin
  377.         { Otherwise get confirmation message and if OKed delete file }
  378.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  379.          mbYesNoCancel , 0 ) = mrYes then
  380.         begin
  381.           ScrollBox1.TheFWB.DeleteTheFile( Currentname );
  382.         end;
  383.       end;
  384.     end;
  385.   end;
  386.   if CurrentView = 1 then { Reset icon display if in view }
  387.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  388. end;
  389.  
  390. { Delphi wrote this; use it to rename selected files }
  391. procedure TCCFileMgrForm.BitBtn4Click(Sender: TObject);
  392. var ThePosition  : Integer;       { Loop counter   }
  393.     CurrentName ,                 { Holds work name}
  394.     TheOldString : String;        { Holds Dir      }
  395.     finished     : Boolean;       { Loop control   }
  396.     WorkingDir   : String;        { Holds mod wd   }
  397. begin
  398.   { Get current directory for later }
  399.   GetDir( 0 , TheOldString );
  400.   { Check for need to add trailing \ }
  401.   WorkingDir := TheOldString;
  402.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  403.   { Set up to do loop for selected files }
  404.   ThePosition := 1;
  405.   finished := false;
  406.   while not finished do
  407.   begin
  408.     { Call generic file getting routine based on current view}
  409.     case CurrentView of
  410.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  411.            ThePosition );
  412.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  413.            ThePosition );
  414.     end;
  415.     { If returns blank string then out of selections }
  416.     if CurrentName = '' then finished := true else
  417.     begin
  418.       { Otherwise set up the opendialog with filename and caption }
  419.       OpenDialog1.Filename := ExtractFilename( CurrentName );
  420.       { Use this to prevent error from changing directories }
  421.       OpenDialog1.Options := [ofNoChangeDir];
  422.       OpenDialog1.Title := 'Rename File';
  423.       { If not cancelled then do rename or signal error }
  424.       if OpenDialog1.Execute then
  425.       begin
  426.         ScrollBox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  427.       end;
  428.     end;
  429.   end;
  430.   if CurrentView = 1 then { Reset icon display if in view }
  431.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  432. end;
  433.  
  434. { Delphi wrote this; use it to make a new directory under current one }
  435. procedure TCCFileMgrForm.BitBtn5Click(Sender: TObject);
  436. begin
  437.   { Set up the dialog to get the new directory name }
  438.   OpenDialog2.FileName := '*.*';
  439.   OpenDialog2.Title := 'Enter Directory Name';
  440.   if OpenDialog1.Execute then
  441.   begin
  442.     { If not cancelled make new directory }
  443.     Scrollbox1.TheFWB.CreateNewDirectory( OpenDialog1.Filename );
  444.   end;
  445.   if CurrentView = 1 then { Reset icon display if in view }
  446.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  447. end;
  448.  
  449. { Delphi wrote this; use it to handle refreshing the scrollbox }
  450. procedure TCCFileMgrForm.FormPaint(Sender: TObject);
  451. var CurrentDirectory : String; { Get current dir }
  452. begin
  453.   { If updated, do refresh }
  454.   if ScrollBox1.IconsNeedRefreshing then
  455.   begin
  456.     Scrollbox1.ClearTheFIPs;
  457.     ScrollBox1.IconsNeedRefreshing := false;
  458.     GetDir( 0 , CurrentDirectory );
  459.     { Force trailing backslash }
  460.     CurrentDirectory := ScrollBox1.TheFWB.ForceTrailingBackSlash(
  461.      CurrentDirectory );
  462.     { Set the label to the new directory }
  463.     Label1.Caption := UpperCase( CurrentDirectory );
  464.     { Do the update }
  465.     ScrollBox1.GetIconsForEntireDirectory( CurrentDirectory );
  466.   end;
  467. end;
  468.  
  469. { Delphi wrote this; use it to reset the current view Icons/List }
  470. procedure TCCFileMgrForm.BitBtn8Click(Sender: TObject);
  471. var TheOldString : String; { Use to get current directory }
  472. begin
  473.   { Reset currentview }
  474.   if CurrentView = 1 then CurrentView := 2 else
  475.    CurrentView := 1;
  476.   { either show the windows boxes or the scrollbox }
  477.   case CurrentView of
  478.     1 : begin
  479.           { Make the listboxes invisible by changing align and width }
  480.           FileListBox1.Visible := false;
  481.           FileListBox1.Align := alNone;
  482.           FileListBox1.Width := 0;
  483.           DirectoryListBox1.Visible := false;
  484.           DirectoryListBox1.align := alNone;
  485.           DirectoryListBox1.Width := 0;
  486.           { Keep them from getting mouse clicks }
  487.           FileListBox1.Enabled := false;
  488.           DirectoryListBox1.Enabled := false;
  489.           { Have the scrollbox get mouse and be seen  by resetting align/wid}
  490.           Scrollbox1.align := alClient;
  491.           Scrollbox1.width := Panel1.Width - 32;
  492.           ScrollBox1.Enabled := true;
  493.           { Tell the scrollbox to repaint itself just in case }
  494.           ScrollBox1.Update;
  495.         end;
  496.     2 : begin
  497.           { Make the listboxes visible by resetting align and width}
  498.           FileListBox1.Visible := true;
  499.           DirectoryListBox1.Visible := true;
  500.           DirectoryListBox1.width := 145;
  501.           DirectoryListBox1.align := alLeft;
  502.           FileListBox1.align := alClient;
  503.           FileListBox1.Width := Panel1.Width - 32 - DirectoryListBox1.Width;
  504.           { Have them getting mouse clicks }
  505.           FileListBox1.Enabled := true;
  506.           DirectoryListBox1.Enabled := true;
  507.           { Have the scrollbox not get mouse and not be seen via align/width}
  508.           ScrollBox1.Enabled := false;
  509.           ScrollBox1.Visible := false;
  510.           ScrollBox1.align := alNone;
  511.           ScrollBox1.Width := 0;
  512.         end;
  513.   end;
  514.   Invalidate;
  515. end;
  516.  
  517. { Delphi wrote this; use it to do a file search display }
  518. procedure TCCFileMgrForm.BitBtn9Click(Sender: TObject);
  519. var CurrentDirectory : String; { Holds current directory }
  520. begin
  521.   { Set up and run the search dialog }
  522.   OpenDialog2.FileName := '*.*';
  523.   { if not cancelled do the search }
  524.   if OpenDialog2.Execute then
  525.   begin
  526.     { Get current directory }
  527.     GetDir( 0 , CurrentDirectory );
  528.     { Force trailing backslash }
  529.     CurrentDirectory :=
  530.      ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentDirectory );
  531.     { display recursive search results }
  532.     GlobalAbortFlag := false;
  533.     Scrollbox1.DisplayRecursiveSearchResults(
  534.      CurrentDirectory + OpenDialog2.Filename );
  535.     Label1.Caption := 'Search Results for ' + CurrentDirectory +
  536.      OpenDialog2.FileName;
  537.   end;
  538. end;
  539.  
  540. { Delphi wrote this; use it to set a file's properties }
  541. procedure TCCFileMgrForm.BitBtn6Click(Sender: TObject);
  542. var ThePosition  : Integer;       { Loop counter   }
  543.     CurrentName ,                 { Holds work name}
  544.     TheOldString : String;        { Holds Dir      }
  545.     finished     : Boolean;       { Loop control   }
  546.     WorkingDir   : String;        { Holds mod wd   }
  547. begin
  548.   { Get current directory for later }
  549.   GetDir( 0 , TheOldString );
  550.   ThePosition := 1;
  551.   { Check for need to add trailing \ }
  552.   Workingdir := TheOldString;
  553.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  554.   { Call generic file getting routine based on current view}
  555.   case CurrentView of
  556.     1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  557.          ThePosition );
  558.     2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  559.          ThePosition );
  560.   end;
  561.   { If nothing selected then abort (gets ..!) }
  562.   if CurrentName = '' then
  563.   begin
  564.     MessageDlg( 'No File Selected!' , mtError , [mbOK] , 0 );
  565.     exit;
  566.   end
  567.   else
  568.   begin
  569.     { Otherwise set up the properties form and show it }
  570.     CCFMPropsForm.WorkingFileName := CurrentName;
  571.     CCFMPropsForm.ThePosition := ThePosition;
  572.     CCFMPropsForm.BitBtn4.Enabled := true;
  573.     CCFMPropsForm.Initialize;
  574.     CCFMPropsForm.ShowModal;
  575.   end;
  576.   if CurrentView = 1 then { Reset icon display if in view }
  577.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  578. end;
  579.  
  580. { Delphi wrote this; use it to drag and drop files for copying }
  581. procedure TCCFileMgrForm.BitBtn1DragDrop(Sender, Source: TObject; X,
  582.   Y: Integer);
  583. var CurrentName ,                 { Holds work name}
  584.     WorkingDir ,
  585.     TheOldString : String;        { Holds Dir      }
  586.     TargetDir    : String;        { target of op   }
  587.     TheResult    : Integer;       { Modal res hold }
  588.     Counter_1    : Integer;
  589. begin
  590.   { Make sure source is indeed a FileIconPanel }
  591.   if Source is TIconFileListbox then
  592.   begin
  593.     with Source as TIconFileListBox do
  594.     begin
  595.      { Get current directory and save it for later }
  596.      GetDir( 0 , TheOldString );
  597.      WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  598.      { Display the Windows-based directory input form }
  599.      TheResult := DestDDForm.ShowModal;
  600.      { If not cancelled do the copy }
  601.      if TheResult = mrOK then
  602.      begin
  603.        for Counter_1 := 1 to Items.Count do
  604.        begin
  605.          if Selected[ Counter_1 - 1 ] then
  606.          begin
  607.             CurrentName := WorkingDIr + Items[ Counter_1 - 1 ];
  608.             { Get the target directory with \ OK }
  609.             TargetDir := DestDDForm.GetTargetDirectory;
  610.             { If a directory signal and do recursive operation }
  611.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  612.             begin
  613.               if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  614.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  615.               begin
  616.                 ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  617.                  TargetDir );
  618.               end;
  619.             end
  620.             else
  621.             begin
  622.               { Do the copy }
  623.               Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  624.             end;
  625.             { Reset to the original directory }
  626.             ChDir( TheOldString );
  627.           end;
  628.         end;
  629.       end;
  630.     end;
  631.     FileListBox1.Update;
  632.     exit;
  633.   end;
  634.   if TheIOManager.WasSHIFTPressed then
  635.   begin
  636.     BitBtn1Click( Source );
  637.     exit;
  638.   end;
  639.   with Source as TFileIconPanel do
  640.   begin
  641.     { Get current directory and save it for later }
  642.     GetDir( 0 , TheOldString );
  643.     { Display the Windows-based directory input form }
  644.     TheResult := DestDDForm.ShowModal;
  645.     { If not cancelled do the copy }
  646.     if TheResult = mrOK then
  647.     begin
  648.       CurrentName := FTheName;
  649.       { Get the target directory with \ OK }
  650.       TargetDir := DestDDForm.GetTargetDirectory;
  651.       { If a directory signal and do recursive operation }
  652.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  653.       begin
  654.         if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  655.          +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  656.         begin
  657.           ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  658.            TargetDir );
  659.         end;
  660.       end
  661.       else
  662.       begin
  663.         { Do the copy }
  664.         Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  665.       end;
  666.       { Reset to the original directory }
  667.       ChDir( TheOldString );
  668.     end;
  669.   end;
  670. end;
  671.  
  672. { Delphi wrote this; use it to generically OK DnD from FIPs }
  673. procedure TCCFileMgrForm.BitBtn1DragOver(Sender, Source: TObject; X,
  674.   Y: Integer; State: TDragState; var Accept: Boolean);
  675. begin
  676.   { Only accept from FileIconPanel components }
  677.   if ( Source is TFileIconPanel ) or
  678.      ( Source is TIconFileListBox ) then Accept := true else Accept := false;
  679. end;
  680.  
  681. { Delphi wrote this; use it to accept Drag and Drop moving }
  682. procedure TCCFileMgrForm.BitBtn2DragDrop(Sender, Source: TObject; X,
  683.   Y: Integer);
  684. var CurrentName ,                 { Holds work name}
  685.     WorkingDir ,
  686.     TheOldString : String;        { Holds Dir      }
  687.     TargetDir    : String;        { target of op   }
  688.     TheResult       : Integer;    { Modal res hold }
  689.     Counter_1   : Integer;
  690. begin
  691.   { Make sure source is indeed a FileIconPanel }
  692.   if Source is TIconFileListbox then
  693.   begin
  694.     with Source as TIconFileListBox do
  695.     begin
  696.       { Get current directory and save it for later }
  697.       GetDir( 0 , TheOldString );
  698.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  699.       { Display the Windows-based directory input form }
  700.       TheResult := DestDDForm.ShowModal;
  701.       for Counter_1 := 1 to Items.Count do
  702.       begin
  703.         if Selected[ Counter_1 - 1 ] then
  704.         begin
  705.           { If not cancelled do the copy }
  706.           if TheResult = mrOK then
  707.           begin
  708.             CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  709.             { Get the target directory with \ OK }
  710.             TargetDir := DestDDForm.GetTargetDirectory;
  711.             { If a directory signal and do recursive operation }
  712.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  713.             begin
  714.               if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir
  715.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  716.               begin
  717.                 ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  718.                  TargetDir );
  719.               end;
  720.             end
  721.             else
  722.             begin
  723.               { Do the copy }
  724.               Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  725.             end;
  726.             { Reset to the original directory }
  727.             ChDir( TheOldString );
  728.           end;
  729.         end;
  730.       end;
  731.     end;
  732.     FileListBox1.Update;
  733.     exit;
  734.   end;
  735.   if TheIOManager.WasSHIFTPressed then
  736.   begin
  737.     BitBtn2Click( Source );
  738.     exit;
  739.   end;
  740.   with Source as TFileIconPanel do
  741.   begin
  742.     { Get current directory and save it for later }
  743.     GetDir( 0 , TheOldString );
  744.     { Display the Windows-based directory input form }
  745.     TheResult := DestDDForm.ShowModal;
  746.     { If not cancelled do the copy }
  747.     if TheResult = mrOK then
  748.     begin
  749.       { Get the target directory with \ OK }
  750.       TargetDir := DestDDForm.GetTargetDirectory;
  751.       { If Copyfile returns false an error occurred }
  752.       CurrentName := FTheName;
  753.       { If a directory signal and do recursion }
  754.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  755.       begin
  756.         if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  757.          '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  758.           ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  759.            TargetDir );
  760.       end
  761.       else
  762.       begin  { Do the move }
  763.         Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  764.         ChDir( TheOldString );
  765.       end;
  766.       { Refresh display }
  767.       ScrollBox1.Update;
  768.     end;
  769.   end;
  770. end;
  771.  
  772. { Delphi wrote this; use it to do drag and drop deletes }
  773. procedure TCCFileMgrForm.BitBtn3DragDrop(Sender, Source: TObject; X,
  774.   Y: Integer);
  775. var WorkingDir ,
  776.     CurrentName : String;  { Holds work name}
  777.     Counter_1   : Integer;
  778. begin
  779.   { Make sure source is indeed a FileIconPanel }
  780.   if Source is TIconFileListbox then
  781.   begin
  782.     with Source as TIconFileListBox do
  783.     begin
  784.       GetDir( 0 , WorkingDir );
  785.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  786.       for Counter_1 := 1 to Items.Count do
  787.       begin
  788.         if Selected[ Counter_1 - 1 ] then
  789.         begin
  790.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  791.           { If a directory signal and do recursive operation }
  792.           if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  793.           begin
  794.             if MessageDlg( 'Delete Directory ' + CurrentName +'?',
  795.              mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  796.             begin
  797.               ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  798.               Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  799.             end;
  800.           end
  801.           else
  802.           begin
  803.             if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  804.              mbYesNoCancel , 0 ) = mrYes then
  805.             begin
  806.               Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  807.             end;
  808.           end;
  809.         end;
  810.       end;
  811.     end;
  812.     FileListBox1.Update;
  813.     exit;
  814.   end;
  815.   if TheIOManager.WasSHIFTPressed then
  816.   begin
  817.     BitBtn3Click( Source );
  818.     exit;
  819.   end;
  820.   with Source as TFileIconPanel do
  821.   begin
  822.     CurrentName := FTheName;
  823.     { If its a directory signal and do recursive delete }
  824.     if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  825.     begin
  826.       if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  827.        mbYesNoCancel , 0 ) = mrYes then
  828.       begin
  829.         Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  830.         Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  831.       end;
  832.     end
  833.     else
  834.     begin
  835.       { Otherwise get confirmation message and if OKed delete file }
  836.       if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  837.        mbYesNoCancel , 0 ) = mrYes then
  838.       begin
  839.         Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  840.       end;
  841.     end;
  842.     { Refresh Display }
  843.     Scrollbox1.Update;
  844.   end;
  845. end;
  846.  
  847. { Delphi wrote this; use it to do drag and drop renames }
  848. procedure TCCFileMgrForm.BitBtn4DragDrop(Sender, Source: TObject; X,
  849.   Y: Integer);
  850. var WorkingDir ,
  851.     CurrentName : String;  { Holds work name}
  852.     Counter_1   : Integer;
  853. begin
  854.   { Make sure source is indeed a FileIconPanel }
  855.   if Source is TIconFileListbox then
  856.   begin
  857.     with Source as TIconFileListBox do
  858.     begin
  859.       GetDir( 0 , WorkingDir );
  860.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  861.       for Counter_1 := 1 to Items.Count do
  862.       begin
  863.         if Selected[ Counter_1 - 1 ] then
  864.         begin
  865.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  866.           { Otherwise set up the opendialog with filename and caption }
  867.           OpenDialog2.Filename := ExtractFilename( CurrentName );
  868.           { Use this to prevent error from changing directories }
  869.           OpenDialog2.Options := [ofNoChangeDir];
  870.           OpenDialog2.Title := 'Rename File';
  871.           { If not cancelled then do rename or signal error }
  872.           if OpenDialog2.Execute then
  873.           begin
  874.             Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  875.           end;
  876.         end;
  877.       end;
  878.     end;
  879.     FileListBox1.Update;
  880.     exit;
  881.   end;
  882.   if TheIOManager.WasSHIFTPressed then
  883.   begin
  884.     BitBtn4Click( Source );
  885.     exit;
  886.   end;
  887.   with Source as TFileIconPanel do
  888.   begin
  889.     CurrentName := FTheName;
  890.     { If a directory signal error }
  891.     { Otherwise set up the opendialog with filename and caption }
  892.     OpenDialog2.Filename := ExtractFilename( CurrentName );
  893.     { Use this to prevent error from changing directories }
  894.     OpenDialog2.Options := [ofNoChangeDir];
  895.     OpenDialog2.Title := 'Rename File';
  896.     { If not cancelled then do rename or signal error }
  897.     if OpenDialog2.Execute then
  898.     begin
  899.       Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  900.     end;
  901.     { Refresh the display }
  902.     ScrollBox1.Update;
  903.   end;
  904. end;
  905.  
  906. procedure TCCFileMgrForm.BitBtn10Click(Sender: TObject);
  907. var TheCCFMForm : TCCFileMgrForm;
  908. begin
  909.   TheCCFMForm := TCCFileMgrForm.Create( Application );
  910.   TheCCFMForm.Show;
  911. end;
  912.  
  913. procedure TCCFileMgrForm.FormDestroy(Sender: TObject);
  914. begin
  915.   { Release the IO Manager }
  916.   if assigned( TheIOManager) then
  917.   begin
  918.     TheIOManager.Free;
  919.     TheIOManager := nil;
  920.   end;
  921.   if Assigned( TheMouseManager ) then
  922.   begin
  923.     TheMouseManager.Free;
  924.     TheMouseManager := nil;
  925.   end;
  926. end;
  927.  
  928. procedure TCCFileMgrForm.FormKeyDown(Sender: TObject; var Key: Word;
  929.   Shift: TShiftState);
  930. var S_lock , N_Lock , C_lock : Boolean;
  931. begin
  932.   case Key of
  933.     VK_Capital : begin
  934.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  935.                    C_Lock := not C_Lock;
  936.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  937.                    Label2.Visible := C_Lock;
  938.                  end;
  939.     VK_End : begin
  940.                 ScrollBox1.VertScrollbar.Position :=
  941.                  ScrollBox1.VertScrollbar.Range;
  942.                 ScrollBox1.HorzScrollbar.Position :=
  943.                  ScrollBox1.HorzScrollBar.Range;
  944.              end;
  945.     VK_Home : begin
  946.                 ScrollBox1.VertScrollbar.Position := 0;
  947.                 ScrollBox1.HorzScrollbar.Position := 0;
  948.               end;
  949.     VK_Left : begin
  950.                 TheMouseManager.InitializeNormal;
  951.                 TheIOManager.WhichState := Shift;
  952.                 if TheIOManager.WasSHIFTPressed then
  953.                  TheMouseManager.MoveSmallJumpLeft else
  954.                   if TheIOManager.WasCTRLPressed then
  955.                    TheMouseManager.MoveLargeJumpLeft else
  956.                     TheMouseManager.MoveSinglePixelLeft;
  957.               end;
  958.     VK_Up : begin
  959.                 TheMouseManager.InitializeNormal;
  960.                 TheIOManager.WhichState := Shift;
  961.                 if TheIOManager.WasSHIFTPressed then
  962.                  TheMouseManager.MoveSmallJumpUP else
  963.                   if TheIOManager.WasCTRLPressed then
  964.                    TheMouseManager.MoveLargeJumpUp else
  965.                     TheMouseManager.MoveSinglePixelUp;
  966.               end;
  967.     VK_Right : begin
  968.                 TheMouseManager.InitializeNormal;
  969.                 TheIOManager.WhichState := Shift;
  970.                 if TheIOManager.WasSHIFTPressed then
  971.                  TheMouseManager.MoveSmallJumpRight else
  972.                   if TheIOManager.WasCTRLPressed then
  973.                    TheMouseManager.MoveLargeJumpRight else
  974.                     TheMouseManager.MoveSinglePixelRight;
  975.               end;
  976.     VK_Down : begin
  977.                 TheMouseManager.InitializeNormal;
  978.                 TheIOManager.WhichState := Shift;
  979.                 if TheIOManager.WasSHIFTPressed then
  980.                  TheMouseManager.MoveSmallJumpDown else
  981.                   if TheIOManager.WasCTRLPressed then
  982.                    TheMouseManager.MoveLargeJumpDown else
  983.                     TheMouseManager.MoveSinglePixelDown;
  984.               end;
  985.     VK_F1 : TheIOManager.OnF1Pressed( Sender , Key , Shift );
  986.     VK_F2 : TheIOManager.OnF2Pressed( Sender , Key , Shift );
  987.     VK_F3 : TheIOManager.OnF3Pressed( Sender , Key , Shift );
  988.     VK_F4 : TheIOManager.OnF4Pressed( Sender , Key , Shift );
  989.     VK_F5 : TheIOManager.OnF5Pressed( Sender , Key , Shift );
  990.     VK_F6 : TheIOManager.OnF6Pressed( Sender , Key , Shift );
  991.     VK_F7 : TheIOManager.OnF7Pressed( Sender , Key , Shift );
  992.     VK_F8 : TheIOManager.OnF8Pressed( Sender , Key , Shift );
  993.     VK_F9 : TheIOManager.OnF9Pressed( Sender , Key , Shift );
  994.     VK_F10 : TheIOManager.OnF10Pressed( Sender , Key , Shift );
  995.     VK_F11 : TheIOManager.OnF11Pressed( Sender , Key , Shift );
  996.     VK_F12 : TheIOManager.OnF12Pressed( Sender , Key , Shift );
  997.     VK_Numlock : Begin
  998.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  999.                    N_Lock := not N_Lock;
  1000.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1001.                    Label3.Visible := N_Lock;
  1002.                  end;
  1003.     VK_Scroll : Begin
  1004.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1005.                    S_Lock := not S_Lock;
  1006.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1007.                    Label4.Visible := S_Lock;
  1008.                 end;
  1009.   end;
  1010. end;
  1011.  
  1012. procedure TCCFileMgrForm.BitBtn9KeyDown(Sender: TObject; var Key: Word;
  1013.   Shift: TShiftState);
  1014. begin
  1015.   case Key of
  1016.     VK_CANCEL : begin
  1017.                   if MessageDlg( 'Control Break Pressed! Abort Search?',
  1018.                    mtConfirmation,mbYesNoCancel,0) = mrYes
  1019.                     then GlobalAbortFlag := true;
  1020.                 end;
  1021.   end;
  1022. end;
  1023.  
  1024. procedure TCCFileMgrForm.Label2Click(Sender: TObject);
  1025. var C_Lock , N_Lock , S_Lock : Boolean;
  1026. begin
  1027.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1028.   C_Lock := not C_Lock;
  1029.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1030.   Label2.Visible := C_Lock;
  1031. end;
  1032.  
  1033. procedure TCCFileMgrForm.Label3Click(Sender: TObject);
  1034. var C_Lock , N_Lock , S_Lock : Boolean;
  1035. begin
  1036.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1037.   N_Lock := not N_Lock;
  1038.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1039.   Label3.Visible := N_Lock;
  1040. end;
  1041.  
  1042. procedure TCCFileMgrForm.Label4Click(Sender: TObject);
  1043. var C_Lock , N_Lock , S_Lock : Boolean;
  1044. begin
  1045.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1046.   S_Lock := not S_Lock;
  1047.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1048.   Label4.Visible := S_Lock;
  1049. end;
  1050.  
  1051. procedure TCCFileMgrForm.Panel2MouseMove(Sender: TObject;
  1052.   Shift: TShiftState; X, Y: Integer);
  1053. var ThePoint, TheOtherPoint : TPoint;
  1054. begin
  1055.   if IconDragging then
  1056.   begin
  1057.     ThePoint.X := X + Panel2.Left;
  1058.     ThePoint.Y := Y + Panel2.Top;
  1059.     TheOtherPoint := ClientToScreen( ThePoint );
  1060.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1061.     exit;
  1062.   end;
  1063.   if BitmapDragging then
  1064.   begin
  1065.     ThePoint.X := X + Panel2.Left;
  1066.     ThePoint.Y := Y + Panel2.Top;
  1067.     TheOtherPoint := ClientToScreen( ThePoint );
  1068.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1069.     exit;
  1070.   end;
  1071. end;
  1072.  
  1073. procedure TCCFileMgrForm.Panel1MouseMove(Sender: TObject;
  1074.   Shift: TShiftState; X, Y: Integer);
  1075. var ThePoint, TheOtherPoint : TPoint;
  1076. begin
  1077.   if IconDragging then
  1078.   begin
  1079.     ThePoint.X := X + Panel1.Left;
  1080.     ThePoint.Y := Y + Panel1.Top;
  1081.     TheOtherPoint := ClientToScreen( ThePoint );
  1082.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1083.     exit;
  1084.   end;
  1085.   if BitmapDragging then
  1086.   begin
  1087.     ThePoint.X := X + Panel1.Left;
  1088.     ThePoint.Y := Y + Panel1.Top;
  1089.     TheOtherPoint := ClientToScreen( ThePoint );
  1090.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1091.     exit;
  1092.   end;
  1093. end;
  1094.  
  1095. procedure TCCFileMgrForm.Panel4MouseMove(Sender: TObject;
  1096.   Shift: TShiftState; X, Y: Integer);
  1097. var ThePoint, TheOtherPoint : TPoint;
  1098. begin
  1099.   if IconDragging then
  1100.   begin
  1101.     ThePoint.X := X + Panel4.Left;
  1102.     ThePoint.Y := Y + Panel4.Top;
  1103.     TheOtherPoint := ClientToScreen( ThePoint );
  1104.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1105.     exit;
  1106.   end;
  1107.   if BitmapDragging then
  1108.   begin
  1109.     ThePoint.X := X + Panel4.Left;
  1110.     ThePoint.Y := Y + Panel4.Top;
  1111.     TheOtherPoint := ClientToScreen( ThePoint );
  1112.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1113.     exit;
  1114.   end;
  1115. end;
  1116.  
  1117. procedure TCCFileMgrForm.Panel3MouseMove(Sender: TObject;
  1118.   Shift: TShiftState; X, Y: Integer);
  1119. var ThePoint, TheOtherPoint : TPoint;
  1120. begin
  1121.   if IconDragging then
  1122.   begin
  1123.     ThePoint.X := X + Panel3.Left;
  1124.     ThePoint.Y := Y + Panel3.Top;
  1125.     TheOtherPoint := ClientToScreen( ThePoint );
  1126.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1127.     exit;
  1128.   end;
  1129.   if BitmapDragging then
  1130.   begin
  1131.     ThePoint.X := X + Panel3.Left;
  1132.     ThePoint.Y := Y + Panel3.Top;
  1133.     TheOtherPoint := ClientToScreen( ThePoint );
  1134.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1135.     exit;
  1136.   end;
  1137. end;
  1138.  
  1139. procedure TCCFileMgrForm.BitBtn1MouseMove(Sender: TObject;
  1140.   Shift: TShiftState; X, Y: Integer);
  1141. var ThePoint, TheOtherPoint : TPoint;
  1142. begin
  1143.   if IconDragging then
  1144.   begin
  1145.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1146.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1147.     TheOtherPoint := ClientToScreen( ThePoint );
  1148.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1149.     exit;
  1150.   end;
  1151.   if BitmapDragging then
  1152.   begin
  1153.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1154.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1155.     TheOtherPoint := ClientToScreen( ThePoint );
  1156.     TheMouseManager.MovebitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1157.     exit;
  1158.   end;
  1159. end;
  1160.  
  1161. procedure TCCFileMgrForm.BitBtn2MouseMove(Sender: TObject;
  1162.   Shift: TShiftState; X, Y: Integer);
  1163. var ThePoint, TheOtherPoint : TPoint;
  1164. begin
  1165.   if IconDragging then
  1166.   begin
  1167.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1168.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1169.     TheOtherPoint := ClientToScreen( ThePoint );
  1170.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1171.     exit;
  1172.   end;
  1173.   if BitmapDragging then
  1174.   begin
  1175.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1176.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1177.     TheOtherPoint := ClientToScreen( ThePoint );
  1178.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1179.     exit;
  1180.   end;
  1181. end;
  1182.  
  1183. procedure TCCFileMgrForm.BitBtn3MouseMove(Sender: TObject;
  1184.   Shift: TShiftState; X, Y: Integer);
  1185. var ThePoint, TheOtherPoint : TPoint;
  1186. begin
  1187.   if IconDragging then
  1188.   begin
  1189.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1190.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1191.     TheOtherPoint := ClientToScreen( ThePoint );
  1192.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1193.     exit;
  1194.   end;
  1195.   if BitmapDragging then
  1196.   begin
  1197.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1198.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1199.     TheOtherPoint := ClientToScreen( ThePoint );
  1200.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1201.     exit;
  1202.   end;
  1203. end;
  1204.  
  1205. procedure TCCFileMgrForm.BitBtn4MouseMove(Sender: TObject;
  1206.   Shift: TShiftState; X, Y: Integer);
  1207. var ThePoint, TheOtherPoint : TPoint;
  1208. begin
  1209.   if IconDragging then
  1210.   begin
  1211.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1212.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1213.     TheOtherPoint := ClientToScreen( ThePoint );
  1214.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1215.     exit;
  1216.   end;
  1217.   if BitmapDragging then
  1218.   begin
  1219.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1220.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1221.     TheOtherPoint := ClientToScreen( ThePoint );
  1222.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1223.     exit;
  1224.   end;
  1225. end;
  1226.  
  1227. procedure TCCFileMgrForm.BitBtn5MouseMove(Sender: TObject;
  1228.   Shift: TShiftState; X, Y: Integer);
  1229. var ThePoint, TheOtherPoint : TPoint;
  1230. begin
  1231.   if IconDragging then
  1232.   begin
  1233.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1234.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1235.     TheOtherPoint := ClientToScreen( ThePoint );
  1236.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1237.     exit;
  1238.   end;
  1239.   if BitmapDragging then
  1240.   begin
  1241.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1242.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1243.     TheOtherPoint := ClientToScreen( ThePoint );
  1244.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1245.     exit;
  1246.   end;
  1247. end;
  1248.  
  1249. procedure TCCFileMgrForm.BitBtn8MouseMove(Sender: TObject;
  1250.   Shift: TShiftState; X, Y: Integer);
  1251. var ThePoint, TheOtherPoint : TPoint;
  1252. begin
  1253.   if IconDragging then
  1254.   begin
  1255.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1256.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1257.     TheOtherPoint := ClientToScreen( ThePoint );
  1258.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1259.     exit;
  1260.   end;
  1261.   if BitmapDragging then
  1262.   begin
  1263.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1264.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1265.     TheOtherPoint := ClientToScreen( ThePoint );
  1266.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1267.     exit;
  1268.   end;
  1269. end;
  1270.  
  1271. procedure TCCFileMgrForm.BitBtn9MouseMove(Sender: TObject;
  1272.   Shift: TShiftState; X, Y: Integer);
  1273. var ThePoint, TheOtherPoint : TPoint;
  1274. begin
  1275.   if IconDragging then
  1276.   begin
  1277.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1278.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1279.     TheOtherPoint := ClientToScreen( ThePoint );
  1280.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1281.     exit;
  1282.   end;
  1283.   if BitmapDragging then
  1284.   begin
  1285.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1286.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1287.     TheOtherPoint := ClientToScreen( ThePoint );
  1288.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1289.     exit;
  1290.   end;
  1291. end;
  1292.  
  1293. procedure TCCFileMgrForm.BitBtn6MouseMove(Sender: TObject;
  1294.   Shift: TShiftState; X, Y: Integer);
  1295. var ThePoint, TheOtherPoint : TPoint;
  1296. begin
  1297.   if IconDragging then
  1298.   begin
  1299.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1300.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1301.     TheOtherPoint := ClientToScreen( ThePoint );
  1302.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1303.     exit;
  1304.   end;
  1305.   if BitmapDragging then
  1306.   begin
  1307.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1308.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1309.     TheOtherPoint := ClientToScreen( ThePoint );
  1310.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1311.     exit;
  1312.   end;
  1313. end;
  1314.  
  1315. procedure TCCFileMgrForm.BitBtn7MouseMove(Sender: TObject;
  1316.   Shift: TShiftState; X, Y: Integer);
  1317. var ThePoint, TheOtherPoint : TPoint;
  1318. begin
  1319.   if IconDragging then
  1320.   begin
  1321.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1322.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1323.     TheOtherPoint := ClientToScreen( ThePoint );
  1324.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1325.     exit;
  1326.   end;
  1327.   if BitmapDragging then
  1328.   begin
  1329.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1330.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1331.     TheOtherPoint := ClientToScreen( ThePoint );
  1332.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1333.     exit;
  1334.   end;
  1335. end;
  1336.  
  1337. procedure TCCFileMgrForm.BitBtn10MouseMove(Sender: TObject;
  1338.   Shift: TShiftState; X, Y: Integer);
  1339. var ThePoint, TheOtherPoint : TPoint;
  1340. begin
  1341.   if IconDragging then
  1342.   begin
  1343.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1344.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1345.     TheOtherPoint := ClientToScreen( ThePoint );
  1346.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1347.     exit;
  1348.   end;
  1349.   if BitmapDragging then
  1350.   begin
  1351.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1352.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1353.     TheOtherPoint := ClientToScreen( ThePoint );
  1354.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1355.     exit;
  1356.   end;
  1357. end;
  1358.  
  1359. procedure TCCFileMgrForm.Panel5MouseMove(Sender: TObject;
  1360.   Shift: TShiftState; X, Y: Integer);
  1361. var ThePoint, TheOtherPoint : TPoint;
  1362. begin
  1363.   if IconDragging then
  1364.   begin
  1365.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1366.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1367.     TheOtherPoint := ClientToScreen( ThePoint );
  1368.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1369.     exit;
  1370.   end;
  1371.   if BitmapDragging then
  1372.   begin
  1373.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1374.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1375.     TheOtherPoint := ClientToScreen( ThePoint );
  1376.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1377.     exit;
  1378.   end;
  1379. end;
  1380.  
  1381. procedure TCCFileMgrForm.Panel6MouseMove(Sender: TObject;
  1382.   Shift: TShiftState; X, Y: Integer);
  1383. var ThePoint, TheOtherPoint : TPoint;
  1384. begin
  1385.   if IconDragging then
  1386.   begin
  1387.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1388.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1389.     TheOtherPoint := ClientToScreen( ThePoint );
  1390.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1391.     exit;
  1392.   end;
  1393.   if BitmapDragging then
  1394.   begin
  1395.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1396.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1397.     TheOtherPoint := ClientToScreen( ThePoint );
  1398.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1399.     exit;
  1400.   end;
  1401. end;
  1402.  
  1403. procedure TCCFileMgrForm.Panel7MouseMove(Sender: TObject;
  1404.   Shift: TShiftState; X, Y: Integer);
  1405. var ThePoint, TheOtherPoint : TPoint;
  1406. begin
  1407.   if IconDragging then
  1408.   begin
  1409.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1410.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1411.     TheOtherPoint := ClientToScreen( ThePoint );
  1412.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1413.     exit;
  1414.   end;
  1415.   if BitmapDragging then
  1416.   begin
  1417.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1418.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1419.     TheOtherPoint := ClientToScreen( ThePoint );
  1420.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1421.     exit;
  1422.   end;
  1423. end;
  1424.  
  1425. procedure TCCFileMgrForm.Panel1MouseUp(Sender: TObject;
  1426.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1427. begin
  1428.   if ( IconDragging or BitmapDragging ) then
  1429.   begin
  1430.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1431.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1432.     IconDragging := false;
  1433.     BitmapDragging := false;
  1434.     Invalidate;
  1435.   end;
  1436. end;
  1437.  
  1438. procedure TCCFileMgrForm.BitBtn1MouseUp(Sender: TObject;
  1439.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1440. var CurrentName ,                 { Holds work name}
  1441.     WorkingDir ,
  1442.     TheOldString : String;        { Holds Dir      }
  1443.     TargetDir    : String;        { target of op   }
  1444.     TheResult    : Integer;       { Modal res hold }
  1445.     Counter_1    : Integer;
  1446. begin
  1447.   If ( IconDragging  or BitmapDragging )then
  1448.   begin
  1449.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1450.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1451.     IconDragging := false;
  1452.     BitmapDragging := false;
  1453.     with GlobalSource as TFileIconPanel do
  1454.     begin
  1455.       { Get current directory and save it for later }
  1456.       GetDir( 0 , TheOldString );
  1457.       { Display the Windows-based directory input form }
  1458.       TheResult := DestDDForm.ShowModal;
  1459.       { If not cancelled do the copy }
  1460.       if TheResult = mrOK then
  1461.       begin
  1462.         CurrentName := FTheName;
  1463.         { Get the target directory with \ OK }
  1464.         TargetDir := DestDDForm.GetTargetDirectory;
  1465.         { If a directory signal and do recursive operation }
  1466.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1467.         begin
  1468.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  1469.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  1470.           begin
  1471.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  1472.              TargetDir );
  1473.           end;
  1474.         end
  1475.         else
  1476.         begin
  1477.           { Do the copy }
  1478.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  1479.         end;
  1480.         { Reset to the original directory }
  1481.         ChDir( TheOldString );
  1482.       end
  1483.       else Invalidate;
  1484.     end;
  1485.   end;
  1486. end;
  1487.  
  1488. procedure TCCFileMgrForm.BitBtn2MouseUp(Sender: TObject;
  1489.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1490. var CurrentName ,                 { Holds work name}
  1491.     WorkingDir ,
  1492.     TheOldString : String;        { Holds Dir      }
  1493.     TargetDir    : String;        { target of op   }
  1494.     TheResult       : Integer;    { Modal res hold }
  1495.     Counter_1   : Integer;
  1496. begin
  1497.   If ( IconDragging  or BitmapDragging )then
  1498.   begin
  1499.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1500.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1501.     IconDragging := false;
  1502.     BitmapDragging := false;
  1503.     with GlobalSource as TFileIconPanel do
  1504.     begin
  1505.       { Get current directory and save it for later }
  1506.       GetDir( 0 , TheOldString );
  1507.       { Display the Windows-based directory input form }
  1508.       TheResult := DestDDForm.ShowModal;
  1509.       { If not cancelled do the copy }
  1510.       if TheResult = mrOK then
  1511.       begin
  1512.         { Get the target directory with \ OK }
  1513.         TargetDir := DestDDForm.GetTargetDirectory;
  1514.         { If Copyfile returns false an error occurred }
  1515.         CurrentName := FTheName;
  1516.         { If a directory signal and do recursion }
  1517.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1518.         begin
  1519.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  1520.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  1521.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  1522.              TargetDir );
  1523.         end
  1524.         else
  1525.         begin  { Do the move }
  1526.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  1527.           ChDir( TheOldString );
  1528.         end;
  1529.         { Refresh display }
  1530.         ScrollBox1.Update;
  1531.       end
  1532.       else Invalidate;
  1533.     end;
  1534.   end;
  1535. end;
  1536.  
  1537. procedure TCCFileMgrForm.BitBtn3MouseUp(Sender: TObject;
  1538.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1539. var WorkingDir ,
  1540.     CurrentName : String;  { Holds work name}
  1541.     Counter_1   : Integer;
  1542. begin
  1543.   If ( IconDragging  or BitmapDragging )then
  1544.   begin
  1545.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1546.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1547.     IconDragging := false;
  1548.     BitmapDragging := false;
  1549.     with GLobalSource as TFileIconPanel do
  1550.     begin
  1551.       CurrentName := FTheName;
  1552.       { If its a directory signal and do recursive delete }
  1553.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1554.       begin
  1555.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  1556.          mbYesNoCancel , 0 ) = mrYes then
  1557.         begin
  1558.           Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  1559.           Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  1560.         end
  1561.         else Invalidate;
  1562.       end
  1563.       else
  1564.       begin
  1565.         { Otherwise get confirmation message and if OKed delete file }
  1566.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  1567.          mbYesNoCancel , 0 ) = mrYes then
  1568.         begin
  1569.           Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  1570.         end
  1571.         else Invalidate;
  1572.       end;
  1573.       { Refresh Display }
  1574.       Scrollbox1.Update;
  1575.     end;
  1576.   end;
  1577. end;
  1578.  
  1579. procedure TCCFileMgrForm.BitBtn4MouseUp(Sender: TObject;
  1580.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1581. var WorkingDir ,
  1582.     CurrentName : String;  { Holds work name}
  1583.     Counter_1   : Integer;
  1584. begin
  1585.   If ( IconDragging  or BitmapDragging )then
  1586.   begin
  1587.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1588.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1589.     IconDragging := false;
  1590.     BitmapDragging := false;
  1591.     with GlobalSource as TFileIconPanel do
  1592.     begin
  1593.       CurrentName := FTheName;
  1594.       { If a directory signal error }
  1595.       { Otherwise set up the opendialog with filename and caption }
  1596.       OpenDialog2.Filename := ExtractFilename( CurrentName );
  1597.       { Use this to prevent error from changing directories }
  1598.       OpenDialog2.Options := [ofNoChangeDir];
  1599.       OpenDialog2.Title := 'Rename File';
  1600.       { If not cancelled then do rename or signal error }
  1601.       if OpenDialog2.Execute then
  1602.       begin
  1603.         Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  1604.       end
  1605.       else Invalidate;
  1606.       { Refresh the display }
  1607.       ScrollBox1.Update;
  1608.     end;
  1609.   end;
  1610. end;
  1611.  
  1612. procedure TCCFileMgrForm.BitBtn11Click(Sender: TObject);
  1613. begin
  1614.   CCPrintForm.ShowModal;
  1615. end;
  1616.  
  1617. end.
  1618.